// import { createStore } from "redux";
// import reducer from './reducer'
// export default createStore(reducer);
import { createStore,applyMiddleware } from "redux";
import reducer from "./reducer";
import logger from "redux-logger";
import { persistStore,persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";//默认存储在localStorage中
// import persistReducer from "redux-persist/es/persistReducer";

//生成一个持久化的reducer
var persistedReducer = persistReducer( 
    { key:'redux' , storage }, 
    reducer ,
)
//创建store
var store = createStore(persistedReducer,applyMiddleware(logger,))

//生成一个持久化的store
export var persistor = persistStore(store);

export default store;